package com.sdi.columbus;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class MapData extends  ArrayAdapter<String> 
{
	private final Context context;
	private final String[] values;
	GpsData gpp=new GpsData();
	String[] reg=new String[gpp.getSize()];
	String[] regno=new String[gpp.getSize()]; 
	int i=0;
	public MapData(Context context, String[] values) {
		super(context, R.layout.map_data, values);
		this.context = context;
		this.values = values;
		reg=gpp.getVehicleRegNo();
		for(int i=0;i<gpp.getSize();i++)
		{
			regno[i]=reg[i];
			
		}
		
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.map_data, parent, false);
		TextView textView = (TextView) rowView.findViewById(R.id.label);
		TextView textView1 = (TextView) rowView.findViewById(R.id.label1);
		ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
		textView.setText(values[position]);
	    textView1.setText(regno[i]);
		i++;		

		// Change icon based on name
		String s = values[position];

		System.out.println("list view model"+s);

		if (s.equals("Tavera")) {
			imageView.setImageResource(R.drawable.tavs);
		} else if (s.equals("Innova")) {
			imageView.setImageResource(R.drawable.innovas);
		} else if (s.equals("U-VA")) {
			imageView.setImageResource(R.drawable.uva);
		} else if (s.equals("Bolero")) {
			imageView.setImageResource(R.drawable.bolero);
		}
		 else if (s.equals("Alto")){
			imageView.setImageResource(R.drawable.altos);
		}
		 else if (s.equals("Swift")){
				imageView.setImageResource(R.drawable.swifts);
			}
		 else if (s.equals("Sumo")){
				imageView.setImageResource(R.drawable.sumos);
			}
		 else if (s.equals("Verna")){
				imageView.setImageResource(R.drawable.vernas);
			}
		 else if (s.equals("Winger")){
				imageView.setImageResource(R.drawable.wingers);
			}
		 else if (s.equals("Xylo")){
				imageView.setImageResource(R.drawable.xylos);
			}
		 else if (s.equals("Indica")){
				imageView.setImageResource(R.drawable.indicas);
			}
		 else if (s.equals("Figo")){
				imageView.setImageResource(R.drawable.figos);
			}
		 else if (s.equals("Eicher")){
				imageView.setImageResource(R.drawable.eichers);
			}
		 else if (s.equals("Micra")){
				imageView.setImageResource(R.drawable.micras);
			}
		 else if (s.equals("i10")){
				imageView.setImageResource(R.drawable.i10s);
			}
		 else if (s.equals("Tata")){
				imageView.setImageResource(R.drawable.tatas);
			}
		 else if (s.equals("Mazda")){
				imageView.setImageResource(R.drawable.mazdas);
			}
		 else if (s.equals("Jetta")){
				imageView.setImageResource(R.drawable.jettas);
			}
		 else if (s.equals("Sunny")){
				imageView.setImageResource(R.drawable.sunnys);
			}
		 else if (s.equals("Jeep")){
				imageView.setImageResource(R.drawable.jeeps);
			}
		 else if (s.equals("Eeco")){
				imageView.setImageResource(R.drawable.eecos);
			}
		 else if (s.equals("Ertiga")){
				imageView.setImageResource(R.drawable.ertigas);
			}
		 else if (s.equals("Ashok Leyland")){
				imageView.setImageResource(R.drawable.asoks);
			}
		 else if (s.equals("Accent")){
			 imageView.setImageResource(R.drawable.accent);
			}
		 else if (s.equals("Accord")){
			 imageView.setImageResource(R.drawable.accord);
			}
		 else if (s.equals("Altis")){
			 imageView.setImageResource(R.drawable.altis);
			}
  
		 else if (s.equals("Amaze")){
			 imageView.setImageResource(R.drawable.amaze);
			}
		 else if (s.equals("Aria")){
			 imageView.setImageResource(R.drawable.aria);
		 }
		 else if (s.equals("Astar")){
			 imageView.setImageResource(R.drawable.astar);
		 }
		 else if (s.equals("Audi")){
			 imageView.setImageResource(R.drawable.audi);
			}
  
		 else if (s.equals("Beat")){
			 imageView.setImageResource(R.drawable.beat);
			}
  
		 else if (s.equals("Beetle")){
			 imageView.setImageResource(R.drawable.beetle);
			}
  
		 else if (s.equals("BMW")){
			 imageView.setImageResource(R.drawable.bmw);
			}
		 else if (s.equals("Brio")){
			 imageView.setImageResource(R.drawable.brio);
			}
		 else if (s.equals("City")){
			 imageView.setImageResource(R.drawable.city);
			}
		 else if (s.equals("Civic")){
			 imageView.setImageResource(R.drawable.civic);
			}
		 else if (s.equals("Enjoy")){
			 imageView.setImageResource(R.drawable.enjoy);
			}
  
		 else if (s.equals("Estilo")){
			 imageView.setImageResource(R.drawable.estilo);
			}
		 else if (s.equals("Etios")){
			 imageView.setImageResource(R.drawable.etios);
			}
  
		 else if (s.equals("Fiesta")){
			 imageView.setImageResource(R.drawable.fiesta);
			}
		 else if (s.equals("Fortuner")){
			 imageView.setImageResource(R.drawable.fortuner);
			}
  
		 else if (s.equals("Lancer")){
			 imageView.setImageResource(R.drawable.lancer);
			}

		 else if (s.equals("800")){
			 imageView.setImageResource(R.drawable.m800);
			}

		 else if (s.equals("Nano")){
			 imageView.setImageResource(R.drawable.nano);
			}

		 else if (s.equals("Omini")){
			 imageView.setImageResource(R.drawable.omini);
			}
		 else if (s.equals("Ritz")){
			    
				imageView.setImageResource(R.drawable.ritz);
			}
		 else if (s.equals("Spark")){
			 imageView.setImageResource(R.drawable.spark);
			}
		 else if (s.equals("Wagon r")){
			 imageView.setImageResource(R.drawable.wagonr);
			}
		 else if (s.equals("Santro")){
			 imageView.setImageResource(R.drawable.santro);
			}
		 else if (s.equals("Ambassador")){
			 imageView.setImageResource(R.drawable.ambass);
		 }
		
		 else if (s.equals("Scorpio")){
			 imageView.setImageResource(R.drawable.scorpio);
		 }
		 else if (s.equals("Camry")){
			  
				imageView.setImageResource(R.drawable.camry);
			}
		 else if (s.equals("Captiva")){
			   
				imageView.setImageResource(R.drawable.captiva);
			}

		 else if (s.equals("Cooper")){
			   
				imageView.setImageResource(R.drawable.cooper);
			}

		 else if (s.equals("Cruze")){
			    
				imageView.setImageResource(R.drawable.cruze);
			}
		 else if (s.equals("Duster")){
			   
				imageView.setImageResource(R.drawable.duster);
			}

		 else if (s.equals("E20")){
			   
				imageView.setImageResource(R.drawable.e20);
			}

		 else if (s.equals("Elantra")){
			    
				imageView.setImageResource(R.drawable.elantra);
			}

		 else if (s.equals("Endeavour")){
			    
				imageView.setImageResource(R.drawable.endeavourb);
			}
		 else if (s.equals("Eon")){
			   
				imageView.setImageResource(R.drawable.eon);
			}
		 else if (s.equals("Gypsy")){
			 
				imageView.setImageResource(R.drawable.gypsy);
			}

		 else if (s.equals("Jazz")){
			   
				imageView.setImageResource(R.drawable.jazz);
			}
		 else if (s.equals("Kizashib")){
			    
				imageView.setImageResource(R.drawable.kisa);
			}
		 else if (s.equals("Land Cruiser")){
			    
				imageView.setImageResource(R.drawable.landcrsrb);
			}
		 else if (s.equals("Pajero")){
			    
				imageView.setImageResource(R.drawable.pajero);
			}
		 else if (s.equals("Phaeton")){
			    
				imageView.setImageResource(R.drawable.phaeton);
			}
		 else if (s.equals("Polo")){
			
				imageView.setImageResource(R.drawable.polo);
			}
		 else if (s.equals("Prius")){
			 
				imageView.setImageResource(R.drawable.prius);
			}
		 else if (s.equals("Qualis")){
			    
				imageView.setImageResource(R.drawable.qualis);
			}
		 else if (s.equals("Safari")){
			   
				imageView.setImageResource(R.drawable.safari);
			}
		 else if (s.equals("Sail")){
			    
				imageView.setImageResource(R.drawable.sail);
			}
		 else if (s.equals("Skodalaura")){
			    
				imageView.setImageResource(R.drawable.skoda);
			}
		 else if (s.equals("Sonata")){
			    
				imageView.setImageResource(R.drawable.sonata);
			}

		 else if (s.equals("SX4")){
			    
				imageView.setImageResource(R.drawable.sx4);
			}

		 else if (s.equals("Teana")){
			    
				imageView.setImageResource(R.drawable.teana);
			}
		 else if (s.equals("Thar")){
			    
				imageView.setImageResource(R.drawable.thar);
			}
		 else if (s.equals("Toureg")){
			  
				imageView.setImageResource(R.drawable.toureg);
			}
		 else if (s.equals("Vento")){
			    
				imageView.setImageResource(R.drawable.vento);
			}
		 else if (s.equals("Venture")){
			    
				imageView.setImageResource(R.drawable.venture);
			}

		 else if (s.equals("Verito")){
			    
				imageView.setImageResource(R.drawable.verito);
			}
		 else if (s.equals("Xenon")){
			   
				imageView.setImageResource(R.drawable.xenon);
			}
		 else if (s.equals("XUV")){
			    
				imageView.setImageResource(R.drawable.xuv);
			}
		 else if (s.equals("Manza")){
			    
				imageView.setImageResource(R.drawable.manza);
			}
		 else if (s.equals("i20")){
			   
				imageView.setImageResource(R.drawable.i20);
			}
		 else if (s.equals("Passet")){
			   
				imageView.setImageResource(R.drawable.pass);
			}
		 else if (s.equals("Fiat")){
			   
				imageView.setImageResource(R.drawable.fiat);
			}
		 else
		 {
			 imageView.setImageResource(R.drawable.common);
		 }
		
		return rowView;
	}
}


